package cn.uce.cc.rest.control;

import cn.uce.base.entity.CcCustomer;
import cn.uce.base.vo.CcCustomerVo;
import cn.uce.cc.api.service.biz.ICcCustomerBiz;
import cn.uce.web.common.base.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;


 /**
   * @Author liupan
   * @Description  快运系统的客户信息controller
   * @Date  2020-06-30 15:40
   */
@Controller
@RequestMapping(value = "cc/custmer")
@Deprecated
public class CcCustmerController extends BaseController {
    private Logger log = LoggerFactory.getLogger(CcCustmerController.class);

    @Resource
    private ICcCustomerBiz  ccCustomerBiz;

    /**
      * 新增客户
      * @Author liupan
      * @Description
      * @Date  2020-06-30 15:41
      */
    @RequestMapping(value="/addCcCustomer.do")
    @ResponseBody
    public Map<String, Object> addCcCustomer(CcCustomer ccCustomer) {
        try {
            ccCustomerBiz.addCcCustomer(ccCustomer);
        } catch (Exception e) {
            log.error("CcCustmerController,addCcCustomer,Exception", e);
            returnError("新增客户失败");
        }
        return returnSuccess();
    }

     /**
       * 更新客户信息
       * @Author liupan
       * @Description
       * @Date  2020-06-30 15:42
       */
    @RequestMapping(value="/updateCcCustomer.do")
    @ResponseBody
    public Map<String, Object> updateCcCustomer(CcCustomer ccCustomer) {
        try {
            ccCustomerBiz.updateCcCustomer(ccCustomer);
        } catch (Exception e) {
            log.error("CcCustmerController,updateCcCustomer,Exception", e);
            returnError("修改客户信息失败");
        }
        return returnSuccess();
    }


     /**
       * 根据手机号或座机号码查询客户信息
       * @Author liupan
       * @Description
       * @Date  2020-06-30 15:42
       */
    @RequestMapping(value="/findCustemByPhoneNum.do")
    @ResponseBody
    public CcCustomerVo findCustemByPhoneNum(CcCustomer ccCustomerVo) {
        try {
            return ccCustomerBiz.findCustemByPhoneNum(ccCustomerVo);
        } catch (Exception e) {
            log.error("CcCustmerController,findCustemByPhoneNum,Exception", e);
            returnError("查询客户信息失败");
        }
        return null;
    }

}
